package com.lagou.edu.ad.controller;


import com.lagou.edu.ad.entity.PromotionSpace;
import com.lagou.edu.ad.service.IPromotionSpaceService;
import com.lagou.edu.dto.PromotionSpaceDTO;
import com.lagou.edu.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author felix
 * @since 2021-03-08
 */
@RestController
@RequestMapping("/ad/space")
public class PromotionSpaceController {

    @Autowired
    private IPromotionSpaceService promotionSpaceService;

    @RequestMapping("/getAllSpaces")
    List<PromotionSpaceDTO> getAllSpaces() {
        List<PromotionSpace> promotionSpaceList = promotionSpaceService.list();
        return ConvertUtil.convertList(promotionSpaceList, PromotionSpaceDTO.class);
    }

}
